package com.lkd.job;

import com.lkd.common.RedisConstants;
import com.lkd.entity.InfoContentEntity;
import com.lkd.service.InfoContentService;
import com.lkd.utils.TianxingApiUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class TianxingApiDataJob {

    @Autowired
    private InfoContentService infoContentService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    /**
     * 获取舔狗日记数据
     */
    @XxlJob("getTianGouRiJiData")
    public void getTianGouRiJiData(){

//        for (int i = 0; i < 5; i++) {
//            String tiangou = TianxingApiUtil.getData();
//            //1.保存数据库
//            InfoContentEntity infoContentEntity = new InfoContentEntity();
//            infoContentEntity.setContent(tiangou);
//            infoContentEntity.setType(0);
//            infoContentService.save(infoContentEntity);
//
//            //2.保存redis
//            stringRedisTemplate.opsForSet().add(RedisConstants.INFO_CONTENT_PREFIX,tiangou);
//        }



    }
}
